<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Random" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="com.wenjie.shoprankmonitor.User" %>
<%@ page import="com.wenjie.shoprankmonitor.PMF" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Del result.</title>
</head>
<body>
<%
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "select from " + User.class.getName();
List<User> user = (List<User>) pm.newQuery(query).execute();
try {
	int count = user.size();
	Random rand = new Random();
	int targetId = rand.nextInt(count);
	long oid = user.get(targetId).getUser_id();
	User m = pm.getObjectById(User.class, oid);
	pm.deletePersistent(m);
	%><p>Delete finish! The id is <%= oid%></p><%
} finally {
	pm.close();
}
%>
</body>
</html>